package com.seckill.controller;


import com.seckill.rabbitmq.MQSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.seckill.pojo.User;
//import com.seckill.rabbitmq.MQSender;
import com.seckill.vo.RespBean;

/**
 * <p>
 * 秒杀用户表 前端控制器
 * </p>
 *
 * @author levi
 * @since 2021-08-09
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private MQSender mqSender;

    @RequestMapping("/info")
    public RespBean info(User user){
        return RespBean.success(user);
    }

    @RequestMapping("/mq")
    public void mq(){
        mqSender.send("Hello");
    }

    @RequestMapping("/mq/exchange")
    public void mq2Exchange(){
        mqSender.send2FanoutExchange("Hello to exchange");
    }

    @RequestMapping("/mq/direct01")
    public void mq2Direct01(){
        mqSender.send2DirectExchange01("Hello to red");
    }

    @RequestMapping("/mq/direct02")
    public void mq2Direct02(){
        mqSender.send2DirectExchange02("Hello to green");
    }

    @RequestMapping("/mq/topic01")
    public void mq2Topic01(){
        mqSender.send2TopicExchange01("Hello topic01");
    }

    @RequestMapping("/mq/topic02")
    public void mq2Topic02(){
        mqSender.send2TopicExchange02("Hello topic02");
    }

    @RequestMapping("/mq/headers01")
    public void mq2Headers01(){
        mqSender.send2HeadersExchange01("Hello headers01");
    }

    @RequestMapping("/mq/headers02")
    public void mq2Headers02(){
        mqSender.send2HeadersExchange02("Hello headers02");
    }
}
